const common = require('../../../mixins/common')
const pay = require('../../../mixins/pay')
const app = getApp()
const options = {
  /**
   * 页面的初始数据
   */
  data: {
    id: 0,
    page: 1,
    posts: [],
    topicload: true,
    loadmoreShow: false,
    isLastPage: false,
    // 文章组件参数
    focus: false,
    isCommentPage: false,
    inputValue: '',
    imageValue: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      id: options.id,
    })
    this.getShopGoodsPostsList()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    let that = this;
    that.setData({
      page: 1,
      posts: [],
      topicload: true,
      loadmoreShow: false,
      isLastPage: false,
    })
    that.getShopGoodsPostsList()
    wx.hideNavigationBarLoading();
    wx.stopPullDownRefresh();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    let that = this;
    that.setData({
      page: that.data.page + 1,
      loadmoreShow: true,
    })
    that.getShopGoodsPostsList()
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    if (res.from == "button") {
      return {
        title: app.globalData.shareTitle,
        path: '/pages/sticky/sticky?id=' + this.data.postsId,
        imageUrl: '',
      }
    } else {
      return {
        title: app.globalData.shareTitle,
        path: '/pages/tags/tags',
        imageUrl: '',
      }
    }
  },
  //刷新方法
  refreshEvent() {
    this.onPullDownRefresh();
  },
}

pay(options)
common(options)
Page(options)